﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class UserControls_MainNavigation : System.Web.UI.UserControl
{
	// Property for count all categories
	protected int ItemCount
	{
		get;
		set;
	}

    protected void Page_Load(object sender, EventArgs e)
    {
		DataTable menu = new DataTable();
		menu = EF_Category.GetCategory();
		this.ItemCount = menu.Rows.Count;
		MainNavigation.DataSource = menu;
		MainNavigation.DataBind();
    }

	// Render class first or last for menu item
	protected string GetItemClass(int itemIndex)
	{
		if(itemIndex == 0)
		{
			return "first";
		}
		else if (itemIndex == this.ItemCount - 1)
		{
			return "last";
		}
		else
		{
			return "normal";
		}
	}
}